﻿using System.Data;
using MySql.Data.MySqlClient;
using MySql;
using MySql.Data;
using MySql.Data.Types;

namespace NET.Library.Data
{
    /// <summary>
    /// DBMySql
    /// </summary>
    public sealed class DBMySql : DB
    {
        #region Fields

        #endregion

        #region Properties

        #endregion

        #region Constructors

        #endregion

        #region Instance Methods

        #region MySqlDataReader
        ///----------------------------------------------------------------------------------
        /// <summary>
        /// Executes a stored procedure with parameterValues and returns the results as a MySqlDataReader.
        /// </summary>
        /// <param name="storedProcedureName">The name of the Stored Procedure to execute.</param>
        /// <returns></returns>
        ///----------------------------------------------------------------------------------
        public MySqlDataReader DBExecuteMySqlReader(string storedProcedureName)
        {
            return MySqlHelper.ExecuteReader(base.ConnectionString, storedProcedureName);
        }

        public MySqlDataReader DBExecuteMySqlReader(string storedProcedureName, params object[] parameterValues)
        {
            return (MySqlDataReader)base.DBExecuteReader(this.ConnectionString, storedProcedureName, parameterValues);
            //for (int i = 0; i < parameterValues.Length; i++)
            //{
            //    MySqlParameter prm = new MySqlParameter();
            //    prm.Value = parameterValues[i];

            //}

            //MySqlParameterCollection col = my = new MySqlParameterCollection();


            //return MySqlHelper.ExecuteReader(this.ConnectionString,storedProcedureName, parameterValues);
        }
        #endregion

        #region DataSet
        public DataSet DBExecuteDataSet(string storedProcedureName)
        {
            return MySqlHelper.ExecuteDataset(base.ConnectionString,storedProcedureName);
        }
        #endregion

        #region ExecuteNonQuery

        #endregion

        #region ExecuteScalar
        
        #endregion

        #region DataReader

        #endregion

        #endregion
        
        #region Static Methods

        #region DataReader
        //public static MySqlDataReader ExecuteMySqlReader(my CommandType commandType, string commandText)
        //{
        //    return (MySqlDataReader)DatabaseFactory.CreateDatabase().ExecuteReader(commandType, commandText);
        //}

        //public static MySqlDataReader ExecuteMySqlReader(string storedProcedureName)
        //{
        //    return (MySqlDataReader)DatabaseFactory.CreateDatabase().ExecuteReader(storedProcedureName);
        //}

        //public static MySqlDataReader ExecuteMySqlReader(string storedProcedureName, params object[] parameterValues)
        //{
        //    return (MySqlDataReader)DatabaseFactory.CreateDatabase().ExecuteReader(storedProcedureName, parameterValues);
        //}

        //public static MySqlDataReader ExecuteMySqlReader(MySqlCommand command)
        //{
        //    return (MySqlDataReader)DatabaseFactory.CreateDatabase().ExecuteReader(command);
        //}


        #endregion

        #endregion
    }
}
